<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('attendance_groups', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('company_id')->default(0)->index();
            $table->string('name', 50)->comment('考勤组名称');
            $table->unsignedBigInteger('team_id')->default(0)->comment('关联部门ID');
            $table->unsignedBigInteger('shift_id')->default(0)->comment('关联班次ID');
            $table->string('description')->nullable()->comment('考勤组描述');
            $table->json('holidays')->nullable()->comment('自定义节假日（JSON格式）');
            $table->tinyInteger('status')->default(1)->comment('状态：0-禁用，1-启用');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('attendance_groups');
    }
};
